package calculations;

import org.omg.CORBA._PolicyStub;

public class TechniqueEquipment 
{
    private double area;                //hus størrelse i kvadratt meter
    private int time;  
    private int people;
    private int consumptionA;           //avhengig av folket
    private int consumptionB;           //avhengig av hus stoerrelse
    private double consumption;            //stroem forbruk
    private double equipment;               //stroem forbruk i aar
    private double newconsumption;
    private int sTime;
    private double percentage;
    private double percentageHour;
    
    private String name;
    private double usingTime;
    private int start;
    private int end;
    private double cubic;
    
    
    public TechniqueEquipment(double _area, int _time)
    {
        area = _area;
        time = _time;
    }
    /**
     * Construktor til ting som kjører kontinuerlig
     * @param _name - navn
     * @param _consumption - strøm forbruk
     * @param _usingTime 
     */
    public TechniqueEquipment(String _name, double _consumption, double _usingTime)
    {
        name = _name;
        consumption = _consumption;
        usingTime = _usingTime;
        
    }
    
    public TechniqueEquipment(String _name, double _consumption, double _usingTime, int _people, int _start, int _end)
    {
    	name = _name;
        consumption = _consumption;
        usingTime = _usingTime;
        people = _people;
        start = _start;
        end = _end;
    }
    
    public double Demo()
    {
        consumptionA = 0;                               //gjennomsnitt variabel
        consumptionB = 0;                               //gjennomsnitt variabel
        consumption = consumptionA + consumptionB;     //gjennomsnitt variabel
        equipment = consumption * area;
        
        return equipment;
    }
    
    /**
     * DemoMk2 skal brukes med andre konstruktor som beregner
     * strøm forbruk basert på strøm forbruk i time og bruketid
     * @return 
     */
    public double DemoMk2()
    {
        equipment = consumption * usingTime * 365 ;
        return equipment;
    }
    
    public double Totalconsumption(double _consumption)
    {
        percentage = _consumption / 80 * 20;
        return percentage;
    }
    
    public void setTime(int _sTime) {
		sTime = _sTime;
	}
    
    public double dayDemonstaration() 
    {
		if (sTime >= 0 && sTime <= 5) {
			percentageHour = (percentage * 0.01) + ((-5) + (int)(Math.random() * (20 - (-5) + 1)));
		} else if (sTime >= 6 && sTime <= 8) {
			percentageHour = (percentage * 0.08) + ((-40) + (int)(Math.random() * (70 - (-40) + 1)));
		} else if (sTime >= 9 && sTime <= 14) {
			percentageHour = (percentage * 0.01) + ((-5) + (int)(Math.random() * (15 - (-5) + 1)));
		} else if (sTime >= 15 && sTime <= 17) {
			percentageHour = (percentage * 0.04) + ((-10) + (int)(Math.random() * (30 - (-10) + 1)));
		} else if (sTime >= 18 && sTime <= 22) {
			percentageHour = (percentage * 0.095) + ((-50) + (int)(Math.random() * (80 - (-50) + 1)));
		} else if (sTime >= 23 && sTime <= 24) {
			percentageHour = (percentage * 0.03) + ((-15) + (int)(Math.random() * (40 - (-15) + 1)));
		}
		return percentageHour;
     }
    
    public double Calculation()
    {
        equipment = consumption * usingTime;       
        return equipment;
    }
    
    
}
